package org.example.api;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class RedisString {
    public static void test1(Jedis jedis) {
        jedis.flushDB();
        jedis.mset("key1","111","key2","222","key3","333","key4","444");
        System.out.println(jedis.mget("key1","key2","key4"));
        System.out.println(jedis.getrange("key1",0,-2));
        System.out.println(jedis.append("key1","00000")+ jedis.get("key1"));
        System.out.println(jedis.strlen("key1"));
        System.out.println(jedis.setrange("key1",5,"56789"));
        jedis.incr("key1");
        System.out.println(jedis.get("key1"));
    }
    public static void main(String[] args) {
        JedisPool jedisPool = new JedisPool("tcp://127.0.0.1:8888");
        try (Jedis jedis = jedisPool.getResource()){
            test1(jedis);
        }
    }
}
